def options(opt):
	opt.load('compiler_c')

def configure(conf):
	conf.load('compiler_c')
	conf.env.append_unique('CFLAGS', ['-Wall','-g'])
	conf.recurse('azure')
	conf.recurse('amazon')

def call_ldconfig(bld):
	bld.exec_command('/sbin/ldconfig')

def build(bld):
	bld.shlib(source='''handle.c io.c open.c xmit.c dir.c lease.c
			    stat.c token.c''',
		  target='elasto_file',
		  vnum='0.0.3',
		  lib=['crypto', 'expat', 'ssl',
		       ':libevent-2.1.so.5', ':libevent_openssl-2.1.so.5',
		       'dl'],
		  use=['elasto_core'],
		  includes = '. .. ../../',
		  defines = ['_GNU_SOURCE'])
	bld.install_as('${INCLUDEDIR}/elasto/file.h', 'file_api.h')
	if bld.cmd == 'install':
		bld.add_post_fun(call_ldconfig)
	bld.recurse('azure')
	bld.recurse('amazon')
